package com.swfgui.managers
{
	import com.swfgui.controls.ToolTip;
	import com.swfgui.controls.ToolTip2;
	
	import flash.display.DisplayObject;
	import flash.events.EventDispatcher;

	/**
	 *
	 * @author llj
	 *
	 */
	public class ToolTipManager extends EventDispatcher
	{
		public function ToolTipManager()
		{
			
		}

		private static var impl:IToolTipManagerImpl = new ToolTipManagerImpl();

		public static function setImpl(instance:IToolTipManagerImpl):void
		{
			impl = instance;
		}

		public static function registerToolTip(target:DisplayObject, toolTip:Object):void
		{
			var tipObj:DisplayObject;
			if(toolTip is String)
			{
				var tip:ToolTip = new ToolTip();
				tip.htmlText = toolTip as String;
				tipObj = tip;
			}
			else
			{
				tipObj = toolTip as DisplayObject;
			}
			impl.registerToolTip(target, tipObj);
		}
		
		public static function registerToolTip2(target:DisplayObject, toolTip:Object,wid:Number = 200):void
		{
			var tipObj:DisplayObject;
			if(toolTip is String)
			{
				var tip:ToolTip2 = new ToolTip2();
				tip.width = wid;
				tip.htmlText = toolTip as String;
				tipObj = tip;
			}
			else
			{
				tipObj = toolTip as DisplayObject;
			}
			impl.registerToolTip(target, tipObj);
		}

		public static function deleteToolTipFrom(target:DisplayObject):DisplayObject
		{
			return impl.deleteToolTipFrom(target);
		}
		
		public static function show(target:DisplayObject):void
		{
			impl.show(target);	
		}
				
		public static function hide(target:DisplayObject):void
		{
			impl.hide(target);
		}		
		
		public static function get enabled():Boolean
		{
			return impl.enabled;
		}

		public static function set enabled(value:Boolean):void
		{
			impl.enabled = value;
		}
		
		public static function get showDelay():Number
		{
			return impl.showDelay;
		}

		public static function set showDelay(value:Number):void
		{
			impl.showDelay = value;
		}
		
		public static function get hideTimeout():Number
		{
			return impl.hideTimeout;
		}

		public static function set hideTimeout(value:Number):void
		{
			impl.hideTimeout = value;
		}
	}
}